package com.woniuxy.microfundservice.service.impl;

import com.woniuxy.microfundservice.bean.info.FundManagers;
import com.woniuxy.microfundservice.dao.FundManagersDao;
import com.woniuxy.microfundservice.service.FundManagersService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * (FundManagers)表服务实现类
 *
 * @author makejava
 * @since 2021-04-08 09:36:03
 */
@Service("fundManagersService")
public class FundManagersServiceImpl implements FundManagersService {
    @Resource
    private FundManagersDao fundManagersDao;

    /**
     * 通过ID查询单条数据
     *
     * @param id 主键
     * @return 实例对象
     */
    @Override
    public FundManagers queryById(Integer id) {
        return this.fundManagersDao.queryById(id);
    }

    /**
     * 查询多条数据
     *
     * @param offset 查询起始位置
     * @param limit 查询条数
     * @return 对象列表
     */
    @Override
    public List<FundManagers> queryAllByLimit(int offset, int limit) {
        return this.fundManagersDao.queryAllByLimit(offset, limit);
    }

    /**
     * 新增数据
     *
     * @param fundManagers 实例对象
     * @return 实例对象
     */
    @Override
    public FundManagers insert(FundManagers fundManagers) {
        this.fundManagersDao.insert(fundManagers);
        return fundManagers;
    }

    /**
     * 修改数据
     *
     * @param fundManagers 实例对象
     * @return 实例对象
     */
    @Override
    public FundManagers update(FundManagers fundManagers) {
        this.fundManagersDao.update(fundManagers);
        return this.queryById((int) fundManagers.getId());
    }

    /**
     * 通过主键删除数据
     *
     * @param id 主键
     * @return 是否成功
     */
    @Override
    public boolean deleteById(Integer id) {
        return this.fundManagersDao.deleteById(id) > 0;
    }

    @Override
    public List<FundManagers> selectOne(Integer fundId) {
        return fundManagersDao.selectOne(fundId);
    }

    @Override
    public int addOne(List<FundManagers> fundManagers) {
        return fundManagersDao.addOne(fundManagers);
    }

    @Override
    public int updateOne(FundManagers fundManagers) {
        return fundManagersDao.updateOne(fundManagers);
    }
}